<template>
  <div class="grid_cont">
    <div style="display: flex">
      <div style="width: 3px; height: 18px; background-color: rgba(204, 53, 47, 1)"></div>
      <div style="margin-left: 10px; font-size: 16px; line-height: 16px">详情</div>
    </div>
    <div class="line_style">
    </div>
    <el-form v-loading="loading" element-loading-text="Loading..." :model="formParams" ref="formRef" class="label_style"
      label-width="126px">
      <el-form-item required label="活动主题：" prop="theme" style="min-width: 570px;">
        <el-input v-model="formParams.theme" disabled style="max-width: 588px;"
          placeholder="一个简洁明了且富有吸引力的主题，能够准确传达活动的核心内容。" />
      </el-form-item>
      <el-row style="max-width: 732px;min-width: 570px;">
        <el-col :span="12">
          <el-form-item required label="活动开始时间：" prop="beginTime">
            <el-date-picker v-model="formParams.beginTime" disabled type="date" value-format="x" placeholder="选择日期" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item required label="活动结束时间：" prop="endTime">
            <el-date-picker v-model="formParams.endTime" disabled type="date" value-format="x" placeholder="选择日期" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item required label="活动介绍：" prop="content" style="min-width: 570px;">
        <div style="max-width: 586px; text-align: left">
          <div class="introducestyle">
            <Editor v-model="formParams.content" style="max-width: 586px;cursor: not-allowed"
              :editor-config="editorConfig" />
          </div>
        </div>
      </el-form-item>
      <el-form-item label="封面图：" prop="area">
        <UploadImg v-if="formParams.imageUrl" disabled v-model="formParams.imageUrl" :limit="1" />
        <el-upload v-else disabled class="avatar-uploader" style="position:relative">
          <el-icon disabled class="avatar-uploader-icon" />
          <div style="position:absolute;cursor: not-allowed;user-select: none;color: #999;">暂无图片</div>
        </el-upload>
      </el-form-item>
    </el-form>
  </div>
  <div class="grid_cont2">
    <el-button class="grid_btn" @click="detailsbtn">返回</el-button>
  </div>
</template>

<script lang="ts" setup>
import * as getTouristApi from '@/api/smartTourism/index'
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import type { UploadProps } from 'element-plus'
const { push } = useRouter() // 路由
const route = useRoute()
const editorConfig = ref({
  placeholder: '',
  MENU_CONF: {},
  readOnly: readonly
})
const formParams = reactive({
  theme: '',
  beginTime: '',
  endTime: '',
  content: '',
  imageUrl: ''
})
const formRef = ref() // 搜索的表单
const loading = ref(true) // 列表加载中

/** 返回 */
const detailsbtn = () => {
  push({
    name: 'scenicActivities'
  })
}
const getData = () => {
  getTouristApi.getActivitydetail(route.query.id).then((res) => {
    loading.value = false
    formParams.theme = res.topic
    formParams.beginTime = res.beginTime
    formParams.endTime = res.endTime
    formParams.content = res.content
    formParams.imageUrl = res.coverPhotoUrl
  }).catch((error) => {
    loading.value = false
  })
}
onMounted(() => {
  getData()
})
</script>
<style scoped>
.grid_cont {
  min-height: 600px;
  background: #fff;
}

.grid_cont2 {
  width: 100%;
  background: #fff;
  height: 65px;
  justify-content: center;
  align-items: center;
  display: flex;
  padding: 0;
  box-shadow: 0px -2px 6px 0px rgba(188, 188, 188, 0.65);
}

.grid_btn {
  width: 80px;
  height: 30px;
  background-color: #ff9900;
  border: none;
  color: #fff;
}

.grid_btn:hover {
  opacity: 0.8;
}

::v-deep .avatar-uploader .el-upload {
  border: 1px solid var(--el-border-color);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
  cursor: not-allowed;
}

::v-deep .el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 150px;
  height: 150px;
  text-align: center;
  cursor: not-allowed;
  background-color: var(--el-disabled-bg-color);
}

::v-deep.avatar-uploader .el-upload-list {
  display: none !important;
}

::v-deep .el-cascader .el-input.is-focus .el-input__wrapper {
  box-shadow: 0 0 0 1px #cc352f !important;
}

.introducestyle {
  box-shadow: 0 0 0 1px var(--el-disabled-border-color);
  border-radius: 4px;
  background: var(--el-disabled-bg-color) !important;
}

.introducestyle::selection {
  box-shadow: 0 0 0 1px #cc352f !important;
}

::v-deep .w-e-text-placeholder {
  top: 10px;
  left: 0;
  text-align: justify;
  width: 100%;
  overflow: hidden;
  padding: 0 10px;
  text-overflow: ellipsis;
  height: 490px;
  line-height: 24px;
}


::v-deep .w-e-bar {
  background: transparent !important;
}

::v-deep .w-e-text-container {
  background: transparent !important;
}

::v-deep .w-e-bar {
  box-shadow: 0px 1px 0px 0px var(--el-disabled-border-color);
  pointer-events: none;
  cursor: not-allowed;
  background: var(--el-disabled-bg-color) !important;
}

::v-deep .border-solid {
  border-color: var(--el-disabled-bg-color);
  border-radius: 4px;
}

:deep(.w-e-text-container [data-slate-editor] img) {
  cursor: not-allowed !important;
}

:deep(.w-e-text-container [data-slate-editor]) {
  background: var(--el-disabled-bg-color) !important;
  color: #a8abb2;
}

.label_style {
  padding-left: 14px;
  padding-right: 14px;
  text-align: right;
  overflow-x: scroll;
}

::v-deep .label_style::-webkit-scrollbar {
  height: 3px;
}

::v-deep .label_style:hover::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

::v-deep .label_style::-webkit-scrollbar-thumb {
  border-radius: 20px;
  background: transparent;
}

::v-deep .label_style::-webkit-scrollbar-track {
  display: none;
}

.line_style {
  width: 100%;
  height: 1px;
  background-color: rgba(245, 245, 245, 1);
  margin-top: 16px;
  margin-bottom: 30px;
}
</style>